<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	<title>二手车清库活动</title>
	<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
	<script src="https://cdn.bootcss.com/layer/3.0.3/layer.min.js"></script>
	<script src="https://cdn.bootcss.com/layer/3.0.3/mobile/layer.min.js"></script>
	<link href="https://cdn.bootcss.com/layer/3.0.3/mobile/need/layer.min.css" rel="stylesheet">
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
			/*font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;*/
			-webkit-font-smoothing: antialiased;
			-moz-osx-font-smoothing: grayscale;
		}
		a{text-decoration: none;color: #333}
		.clear{ height:0px;line-height:0px;clear:both;}
		.clearfix:after {content: ".";display: block;height: 0;clear: both;visibility: hidden;}
		*+html .clearfix { overflow:hidden;}
		* html .clearfix { height: 1%;}
		img{
			width: 100%;
			display: block
		}
		.list-box{
			background-color: #eb3d37;
			text-align: center;
			padding-bottom: 20px;
		}
		.list-box table{
			background-color: rgba(255,255,255,0.2);
			color: #fff;
			border-collapse:collapse;
			margin: auto;
			width: 90%;
		}
		.list-box table td,.list-box table th{
			border:1px solid #ffa19e;
			font-size: 10px;
		}
		.list-box table tr th{
			background-color: #e85a55;
		}
		.list-box table tr:nth-child(even){
			background-color: #e85a55;
		}
		
		.bottom{
			height: 40px;
			width: 100%;
			position: fixed;
			bottom: 0;
			left: 0;
		}
		.bottom a{
			width: 50%;
			background-color: #103180;
			height: 40px;
			box-sizing: border-box;
			text-align: center;
			line-height: 40px;
			display: inline-block;
			float: left;
			color: #fff;
		}
		.txt{
			text-align: center;
			color: #fff;
			background-color: #eb3d37;
			font-size: 14px;
			padding-bottom: 20px;
		}
		.sub-btn{
			background-color: #e85a55;
			display: inline-block;
			width: 50%;
			height: 40px;
			line-height: 40px;
			text-align: center;
			color: #fff;
			border-radius: 5px;
			margin-top: 20px;
		}
		.pop-box h2{
			line-height: 45px;
		}
		.pop-box p{
			height: 45px;
			line-height: 45px;
		}
		.pop-box p label{
			font-size: 15px;
			margin-right: 10px;
		}
		.pop-box p input{
			height: 24px;
			line-height: 24px;
			padding: 0 5px;
			border:1px solid #ccc;
			outline: none;
			width: 50%;
		}
	</style>
</head>
<body style="padding-bottom: 40px;background-color: #eb3d37;">
	<div>
		<img src="images/img.jpg">
	</div>
	<div class="list-box">
		<table>
			<tr>
				<th>编号</th>
				<th>品牌型号</th>
				<th>排量</th>
				<th>登记日期</th>
				<th>颜色</th>
				<th>表显里程(km)</th>
			</tr>
			<tbody id="tableBody"></tbody>
			
		</table>
	</div>
	<div class="txt">以上列表仅为参考，实际车辆以现场表格为准，<br>数量有限 抓紧报名哦！</div>
	<div class="bottom">
		<a href="tel:4001501999" style="border-right:1px solid #eb3d37">电话咨询</a>
		<a href="#" onclick="entered()">立即报名</a>
	</div>   
</body>
<script type="text/javascript">
	var carList = [
	{
		model:'大众polo',
		displacement:'1.6L',
		date:'2017/5/17',
		color:'红',
		mileage:'1800'
	},
	{
		model:'长安X70T',
		displacement:'1.5T',
		date:'2017/1/25',
		color:'白',
		mileage:'16122'
	},
	{
		model:'大众领驭',
		displacement:'1.8T',
		date:'2009/1/22',
		color:'黑',
		mileage:'220000'
	},
	{
		model:'大众CC',
		displacement:'2.0T',
		date:'2011/5/9',
		color:'黑',
		mileage:'210000'
	},
	{
		model:'长安A800',
		displacement:'1.5T',
		date:'2017/8/17',
		color:'白',
		mileage:'5489'
	},
	{
		model:'吉利金刚',
		displacement:'1.5L',
		date:'2014/9/22',
		color:'白',
		mileage:'100000'
	},
	{
		model:'大众高尔夫',
		displacement:'1.6L',
		date:'2013/6/19',
		color:'蓝',
		mileage:'160000'
	},
	{
		model:'别克君威',
		displacement:'2.0T',
		date:'2017/8/7',
		color:'红',
		mileage:'1900'
	},
	{
		model:'长安奔奔',
		displacement:'1.0L',
		date:'2012/10/15',
		color:'红',
		mileage:'53000'
	},
	{
		model:'上汽大众途观L',
		displacement:'2.0T',
		date:'2017/1/10',
		color:'红',
		mileage:'7000'
	},
	{
		model:'长安X70A',
		displacement:'1.5T',
		date:'2018/3/27',
		color:'棕',
		mileage:'2044'
	},
	{
		model:'现代ix35',
		displacement:'2.0L',
		date:'2010/11/24',
		color:'银',
		mileage:'170000'
	},
	{
		model:'铃木北斗星',
		displacement:'1.0L',
		date:'2013/3/4',
		color:'银',
		mileage:'57000'
	},
	{
		model:'大众途观L',
		displacement:'2.0T',
		date:'2017/1/10',
		color:'红',
		mileage:'1200'
	},
	{
		model:'长安4500',
		displacement:'1.3L',
		date:'2009/12/7',
		color:'银',
		mileage:'110000'
	},
	{
		model:'本田奥德赛',
		displacement:'2.4L',
		date:'2014/1/24',
		color:'白',
		mileage:'110000'
	},
	{
		model:'长安A800',
		displacement:'1.5T',
		date:'2017/8/17',
		color:'白',
		mileage:'36'
	},
	{
		model:'大众帕萨特',
		displacement:'1.8T',
		date:'2011/6/28',
		color:'黑',
		mileage:'108000'
	},
	{
		model:'雪佛兰赛欧',
		displacement:'1.4L',
		date:'2013/5/27',
		color:'白',
		mileage:'132000'
	},
	{
		model:'长安欧尚',
		displacement:'1.5L',
		date:'2016/5/12',
		color:'白',
		mileage:'32450'
	},
	{
		model:'大众宝来',
		displacement:'1.6L',
		date:'2012/9/5',
		color:'蓝',
		mileage:'86000'
	},
	{
		model:'大众途安',
		displacement:'2.0L',
		date:'2007/9/13',
		color:'银',
		mileage:'155000'
	},
	{
		model:'吉利远景',
		displacement:'1.5L',
		date:'2010/12/21',
		color:'白',
		mileage:'95000'
	},
	{
		model:'长安X70A',
		displacement:'1.5T',
		date:'2018/4/3',
		color:'白',
		mileage:'830'
	},
	{
		model:'长安奔奔',
		displacement:'1.0L',
		date:'2010/11/9',
		color:'红',
		mileage:'70000'
	},
	{
		model:'吉利自由舰',
		displacement:'1.3L',
		date:'2006/12/20',
		color:'黑',
		mileage:'144564'
	},
	{
		model:'凯迪拉克XTS',
		displacement:'2.0T',
		date:'2017/11/17',
		color:'白',
		mileage:'3000'
	},
	{
		model:'大众捷达',
		displacement:'1.6L',
		date:'2009/7/22',
		color:'黑',
		mileage:'88000'
	},
	{
		model:'大众途观',
		displacement:'1.8L',
		date:'2010/10/28',
		color:'红',
		mileage:'160000'
	},
	{
		model:'荣威350',
		displacement:'1.6L',
		date:'2014/7/1',
		color:'白',
		mileage:'67821'
	},
	{
		model:'凯迪拉克CT6',
		displacement:'2.0T',
		date:'2017/1/25',
		color:'黑',
		mileage:'13500'
	},
	{
		model:'日产奇骏',
		displacement:'2.5L',
		date:'2010/6/24',
		color:'银',
		mileage:'190000'
	},
	{
		model:'大众途观',
		displacement:'1.8T',
		date:'2012/10/11',
		color:'白',
		mileage:'130000'
	},
	{
		model:'雪佛兰科帕奇',
		displacement:'1.5L',
		date:'2013/5/28',
		color:'黑',
		mileage:'180000'
	},
	{
		model:'别克英朗',
		displacement:'1.0T',
		date:'2017/11/3',
		color:'红',
		mileage:'2000'
	},
	{
		model:'长城C30',
		displacement:'1.5L',
		date:'2011/6/1',
		color:'红',
		mileage:'110000'
	},
	{
		model:'福特福克斯',
		displacement:'1.6L',
		date:'2013/1/11',
		color:'白',
		mileage:'110000'
	},
	{
		model:'大众polo',
		displacement:'1.6L',
		date:'2017/5/10',
		color:'红',
		mileage:'650'
	},
	{
		model:'哈弗H6',
		displacement:'1.5T',
		date:'2016/8/23',
		color:'白',
		mileage:'48266'
	},
	{
		model:'别克君越',
		displacement:'2.0T',
		date:'2016/11/14',
		color:'黑',
		mileage:'30000'
	},
	{
		model:'标致408',
		displacement:'1.6L',
		date:'2011/9/11',
		color:'灰',
		mileage:'130000'
	}
]
	console.log(carList.length)
	for (var i = 0; i < carList.length; i++) {
		var trHtml = "<tr><td>"+(i+1)+"</td>"
					+	"<td>"+carList[i].model+"</td>"
					+	"<td>"+carList[i].displacement+"</td>"
					+	"<td>"+carList[i].date+"</td>"
					+	"<td>"+carList[i].color+"</td>"
					+	"<td>"+carList[i].mileage+"</td>"
					+"</tr>" 
		
		$('#tableBody').append(trHtml);
	}

	function entered() {
		var contentHtml = '<div class="pop-box"><p><label>您的姓名：</label><input type="text" name="userName" id="userName" required></p><p><label>您的电话：</label><input type="tel" maxLength="11" name="userMobile" id="userMobile" required></p></div>'
		layer.open({
			title: [
				'报名通道',
				'background-color:#eb3d37; color:#fff;line-height:44px;height:44px;'
			],
			content: contentHtml,
			btn: ['立即报名', '取消'],
			yes: function(index) {
				var pass = $('#userMobile').val();
				if ($('#userName').val() == '') {
					alert('请输入姓名！');
					return false;
				}
				if(!(/^[1][3,4,5,7,8][0-9]{9}$/.test(pass))) {
					alert('请填写正确格式的手机号！');
					$('#userMobile').focus();
					return false;
				}
				$.ajax({
					headers: {
				        source: "activeUser"
				    },
					type: "get", //data 传送数据类型。post 传递
					dataType: 'json', // 返回数据的数据类型json
					url: '/controller/cooperation/insertCooperation',
					cache: false,
					data: {
						'cooperationMobile': pass,
						'cooperationName': $('#userName').val()
					}, //传送的数据
					error: function() {
						alert("数据传输错误");
					},
					success: function(data) {
						if(data.code != 1) {
							alert(data.msg);
							return false;
						}
						layer.open({
							content: '恭喜您报名成功！',
							skin: 'msg',
							time: 3 //2秒后自动关闭
						});
					}
				});
			}
		});
	}
</script>
</html>